package com.minelx.datamicroscope.core.query.literalcondition;

import com.alibaba.fastjson.JSONObject;
import com.minelx.datamicroscope.core.query.RawConditionFactory;

import java.util.List;

public interface LiteralConditionParser {
    boolean match(JSONObject data);

    LiteralCondition createLiteralCondition(JSONObject data);

    static LiteralConditionParser contentAndField() {
        return new ContentAndFieldLiteralConditionParser();
    }

    static LiteralConditionParser keyOperand(RawConditionFactory rawConditionFactory) {
        return new KeyOperandLiteralConditionParser(rawConditionFactory);
    }

    static AutoDeterminingLiteralConditionParser list(List<LiteralConditionParser> literalConditionParsers) {
        return new AutoDeterminingLiteralConditionParser(literalConditionParsers);
    }
}
